package datagram;

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;

import javax.imageio.ImageIO;

public abstract class Datagram implements Comparable<Datagram> {
	protected BufferedImage 	image				= null;
	
	protected int				comparePrecision	= 10000;
	
	public Datagram( BufferedImage image ) {
		this.image = image;
	}

	public abstract double calculate();
	public abstract double difference( Datagram other );
	public void merge( Datagram other ) {}

	public boolean isLoaded() {
		return image != null;
	}
	
	@Override
	public int compareTo(Datagram other) {
		return (int) (difference(other) * comparePrecision);
	}
}
